package com.yao2san.simdif.controller;

import com.github.pagehelper.PageInfo;
import com.yao2san.common.response.ResponseData;
import com.yao2san.simdif.bean.request.HistoryDeleteReq;
import com.yao2san.simdif.bean.request.HistoryListReq;
import com.yao2san.simdif.bean.response.HistoryListRes;
import com.yao2san.simdif.service.HistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("history")
public class HistoryController {
    @Autowired
    private HistoryService historyService;

    @GetMapping("list")
    public ResponseData<PageInfo<HistoryListRes>> list(HistoryListReq req) {
        PageInfo<HistoryListRes> list = historyService.list(req);
        return ResponseData.success(list);
    }

    @PostMapping("delete")
    public ResponseData<Void> list(@RequestBody HistoryDeleteReq req) {
        historyService.delete(req);
        return ResponseData.success();
    }
}
